#include <iostream>
#include <BinaryTree.hpp>

using namespace std;

class Solution
{
public:
    int countNodes(TreeNode *root)
    {
        if (root == nullptr)
            return 0;
        int count = 0;
        if (root->left)
            count += countNodes(root->left);
        if (root->right)
            count += countNodes(root->right);
        return count + 1;
    }
};
int main()
{
    cout << "Code222" << endl;
    Solution s;
    TreeNode *root = CreatTree("[1,2,3,4]", "null");
    cout << s.countNodes(root) << endl;
    return 0;
}